home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_25001.txt < prev    next >
Text File  |  1991-02-27  |  979b  |  29 lines

  1. -- card: 25001 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. In fact, the identifier of the array is itself treated as a pointer to the zeroth element of the array (remember array indexing begins with 0).  The following are equivalent:
  11.  
  12.     f_array              and    &f_array[0]
  13.     f_array+1          and    &f_array[1]
  14.     *(f_array+1)    and    f_array[1]
  15.  
  16. That is, the syntax:  name[i] is treated the same as:  *(name+i) in C.  If f_ptr contains the address of f_array[5], then the following are equivalent:
  17.  
  18.     f_ptr[1]    and    f_array[6] 
  19.  
  20. However, an important distinction between an array identifier and a true pointer variable is that the former is a constant address, and cannot have a new value assigned to it:
  21.  
  22.     f_array = f_ptr;    /*  disallowed, since f_array is a pointer constant, not variable  */
  23.  
  24.  
  25.  
  26.  
  27. -- part contents for background part 7
  28. ----- text -----
  29. 61